<template>
    <el-table :data="tableData" style="width: 100%" border>
        <el-table-column prop="id" label="编号" width="180"></el-table-column>
        <el-table-column prop="name" label="资源名称" width="180"></el-table-column>
        <el-table-column prop="url" label="资源路径"></el-table-column>
        <el-table-column prop="description" label="描述" />
        <el-table-column label="添加时间">
            <template #default="scope">
                <div>{{scope.row.createTime?dayjs(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss"):"/"}}</div>
            </template>
        </el-table-column>
    </el-table>
    <!-- 分页器 -->
    <el-pagination v-model:currentPage="pagination.pageNum" v-model:page-size="pagination.pageSize"
        :page-sizes="[1,5,10,20]" layout="total,sizes, prev, pager, next,jumper" :total="pagination.total"
        @size-change="handleSizeChange" @current-change="handleCurrentChange" />
</template>
<script setup lang="ts">
import * as api from "@/request/api";
import dayjs from 'dayjs' // ES 2015
import useTable from "@/hooks/useTable"
import { ref } from "vue"

let { tableData, pagination, handleSizeChange, handleCurrentChange, getTableData } = useTable(api.admin.getResourceList, { pageSize: 10 })



</script>